#!/bin/bash

DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")"

function error {
  echo -e "\\e[91m$1\\e[39m"
  exit 1
}

rm -f ~/xsnow.deb
wget -O ~/xsnow.deb https://sourceforge.net/projects/xsnow/files/xsnow_3.3.1-1_armhf.deb/download || error "Failed to download xsnow.deb"

"${DIRECTORY}/pkg-install" "$HOME/xsnow.deb" "$(dirname "$0")" || error "Failed to install xsnow.deb"
rm -f ~/xsnow.deb
